package com.dlkw.easyroom.compiler.classkeeper;

import com.dlkw.easyroom.compiler.Tools;
import com.squareup.javapoet.CodeBlock;
import com.squareup.javapoet.FieldSpec;
import com.squareup.javapoet.TypeSpec;

import javax.lang.model.element.Modifier;
import javax.lang.model.element.TypeElement;

import lombok.EqualsAndHashCode;
import lombok.Getter;
import lombok.Setter;

@Getter
@Setter
@EqualsAndHashCode(callSuper = true)
public class ViewClass extends BaseClass {
    private final String viewName;

    public ViewClass(TypeElement element) {
        super(element);
        this.viewName = Tools.getViewName(element);
    }

    @Override
    protected void fillTypeBuilder(TypeSpec.Builder builder) {
        builder.addField(FieldSpec.builder(String.class, "VIEW_NAME", Modifier.PUBLIC, Modifier.STATIC, Modifier.FINAL).initializer("$S", this.viewName).build());
    }
}
